@import "../base/colors";

.chrome-tabs-shell {
  position: relative;
  padding: 0 18px 0 0px;
  height: 36px;
  border-bottom: 1px solid @border-shell-window;
}

.chrome-tabs {
  position: relative;
  padding-left: 10px;
  height: 36px;

  * {
    -webkit-user-select: none;
    cursor: default;
    font-size: 12px;
    line-height: 13px;
  }

  .chrome-tab {
    position: absolute;
    top: 6px;
    height: 30px;
    width: 40px;
    z-index: 1;
    -webkit-app-region: no-drag;
    border-bottom: 1px solid @border-shell-window;

    .chrome-tab-bg {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 18px;
      margin: 6px 0;
      border-right: 1px solid @border-shell-window;
      // transition: .1s background ease;
    }

    .chrome-tab-favicon {
      width: 16px;
      height: 23px;
      text-align: center;
      position: absolute;
      left: 10px;
      top: 8px;
      z-index: 3;

      img {
        width: 16px;
        height: 16px;
      }

      .fa-gear,
      .fa-download,
      .fa-book,
      .fa-star-o,
      .fa-history,
      .fa-bug,
      .fa-window-maximize {
        font-size: 14px;
        margin-top: 2px;
      }

      .fa-window-maximize {
        margin-right: 5px;
      }
    }

    .spinner {
      position: relative;
      left: 1px;
      top: 1px;
    }

    &.chrome-tab-pinned {
      .chrome-tab-favicon {
        left: 16px;
      }
    }

    .chrome-tab-title {
      position: relative;
      color: @color-tab;
      padding: 9px 11px 5px 30px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;

      .fa-volume-up,
      .fa-volume-mute {
        margin-right: 4px;
      }
    }

    &.chrome-tab-nofavicon .chrome-tab-title {
      padding-left: 16px;
    }

    .chrome-tab-close {
      display: none;
      position: absolute;
      right: 8px;
      top: 7px;
      width: 16px;
      height: 16px;
      z-index: 2;
      border-radius: 2px;
      text-align: center;
      color: #333;

      &:before {
        display: block;
        content: "\00D7";
        font-size: 20px;
        font-weight: 200;
        opacity: 0;
        line-height: .71;
      }

      &:hover:before,
      &:active:before {
        opacity: 1;
      }

      &:hover,
      &:active {
        background: #bbb;
      }
    }

    &.chrome-tab-add-btn {

      .chrome-tab-bg {
        border: none;
        background: none !important;
      }

      .plus {
        display: block;
        font-size: 19px;
        font-weight: 300;
        color: #888;
        margin: 4px 7px;
        width: 22px;
        height: 21px;
        text-align: center;
        line-height: 100%;
        border-radius: 2px;
      }

      &:hover {

        .chrome-tab-close:before {
          opacity: 1;
        }

        .plus {
          background: rgba(0,0,0,.05);
          color: #888;
        }
      }
    }

    &:hover {

      .chrome-tab-bg {
        height: 28px;
        background: #e2e2e2;
        margin: 0;
        border-right: 0;
      }

      .chrome-tab-title {
        // do a hard clip on the text
        text-overflow: initial;
        width: ~"calc(100% - 27px)";

        // add a gradient effect
        &:after {
          content: '';
          display: block;
          position: absolute;
          right: 0;
          top: 1px;
          height: 100%;
          width: 5px;
          background: linear-gradient(to right, rgba(226,226,226,0), rgb(226, 226, 226));
        }
      }

      .chrome-tab-close {
        display: block;
        background: #e2e2e2; // tab :hover background tab

        &:hover {
          background: #ccc;
        }

        &:before {
          opacity: 1;
        }
      }
    }

    &.chrome-tab-dragging {
      //transition: none !important;
    }

    &.chrome-tab-current {
      border: 0;
      //transition: none !important;

      .chrome-tab-favicon {
        top: 8px;
      }

      .chrome-tab-title {
        padding-top: 9px;
        &:after {
          // adjust color
          background: linear-gradient(to right, rgba(247,247,247,0), rgb(247, 247, 247));
        }
      }

      .chrome-tab-bg {
        height: 30px;
        margin: 0;
        background: @background-tab--current;
        border: 1px solid @border-shell-window;
        border-bottom: 0;
        border-radius: 3px 3px 0 0;
      }

      .chrome-tab-close {
        background: @background-tab--current;
      }

      &:hover {

        .chrome-tab-close:hover {
          background: #ddd;
        }
      }
    }

    &.chrome-tab-small {
      .chrome-tab-title {
        display: none;
      }
    }
  }
}

// draggable region for OSX and windows
body.win32 .chrome-tabs,
body.darwin .chrome-tabs {
  display: block;
  -webkit-app-region: drag;
}

// make room for resizing on the top
body.win32 {
  .chrome-tabs-shell {
    padding-top: 4px;
  }

  .chrome-tabs {
    height: 32px;
    
    .chrome-tab {
      top: 2px;
    }
  }
}

// make room for the traffic lights
.darwin:not(.fullscreen) .chrome-tabs {
  padding-left: 75px;
}

// tab styles for when beaker isn't focused
.window-blurred {
  .chrome-tab-current {
    .chrome-tab-bg {
      background: @background-tab--current;
    }
  }
}

// tab styles for when beaker is in fullscreen
.fullscreen {
  .chrome-tab:hover:not(.chrome-tab-current) {
    .chrome-tab-bg {
      background: #dadada;
    }
  }
}
